package System.SystemFacade;

import java.util.Scanner;

public class SystemManager {
    private SystemFacade systemFacade = new SystemFacade();

    public void showMenu() {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("\n=== 系统管理 ===");
            System.out.println("1. 用户权限管理");
            System.out.println("2. 查看作业日志");
            System.out.println("3. 系统健康监测");
            System.out.println("4. 系统备份");
            System.out.println("0. 返回上级菜单");

            int choice = scanner.nextInt();
            scanner.nextLine(); // 消耗换行符

            switch (choice) {
                case 1:
                    manageUserPermissions(scanner);
                    break;
                case 2:
                    viewOperationLogs();
                    break;
                case 3:
                    checkSystemHealth();
                    break;
                case 4:
                    backupSystem();
                    break;
                case 0:
                    return;
                default:
                    System.out.println("无效选择，请重新输入！");
            }
        }
    }

    private void manageUserPermissions(Scanner scanner) {
        System.out.println("用户权限管理功能...");
        systemFacade.logInfo("用户尝试修改权限");
    }

    private void viewOperationLogs() {
        System.out.println("作业日志查看功能...");
        systemFacade.logInfo("用户查看操作日志");
    }

    private void checkSystemHealth() {
        systemFacade.checkSystemHealth();
    }

    private void backupSystem() {
        systemFacade.backupSystem();
    }
}
